Stacked Charts

Silverlight Elements offers stacked versions of bar, line, area, spline and spline area charts. In a stacked chart, each series ‘stacks’ on top of the one before instead of being displayed alongside or overlaid on it. This makes a stacked chart a good way to display data where the total over the series is important as well as the individual values. For example, if each series represents a sales region and each data point represents a time period and the sales during that time period, then the total value across the series is the total sales across all regions during the time period. Since the trend of total sales is likely to be of interest to users, a stacked graph might be a good choice here.

To create a stacked bar chart, add multiple StackedBarSeries to a Chart control:

CopyCreating a stacked bar chart
<ms:Chart Title="Sales" Width="600" Height="400">
  <ms:StackedBarSeries ItemsSource="{Binding [0]}" 
                       XBinding="{Binding Quarter}" 
                       YBinding="{Binding Amount}" 
                       SeriesBrush="Blue" 
                       Title="North Island" 
                       />
  <ms:StackedBarSeries ItemsSource="{Binding [1]}" 
                       XBinding="{Binding Quarter}" 
                       YBinding="{Binding Amount}" 
                       SeriesBrush="Red" 
                       Title="South Island" 
                       />
</ms:Chart>

A stacked series only stacks on other stacked series of the same type. If you put a (non-stacked) LineSeries and a StackedLineSeries into the same chart, the StackedLineSeries won’t factor in the values of the LineSeries. This allows you to add non-stacking data, such as averages or expectations, to a stacking chart.
 

Other kinds of stacked chart are created in a similar way using the appropriate stacked series: StackedLineSeries, StackedAreaSeries, StackedSplineSeries or StackedSplineAreaSeries. Each has the same options as the corresponding non-stacked equivalent: see Bar Charts, Line and Area Charts and Spline Charts for more information.